package com.jh3502.helper.utils.listener;

import android.app.Activity;
import android.content.Context;
import android.view.KeyEvent;
import android.view.inputmethod.EditorInfo;
import android.widget.TextView;

/**
 * Created by harisucici on 2018/4/14 0014.
 */

public class MyEditActionListener implements TextView.OnEditorActionListener {
    private Activity context;
    private String text;

    public MyEditActionListener(Context context, String text) {
        this.context = (Activity) context;
        this.text = text;
    }


    @Override
    public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
        doWhichOperation(actionId);
        return true;
    }

    private void doWhichOperation(int actionId) {
        switch (actionId) {
            case EditorInfo.IME_ACTION_SEND:
//                Intent i= new Intent(Intent.);
//                i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
//                i.addCategory(Intent.CATEGORY_HOME);
//                startActivity(i);
                break;
            default:
                break;
        }
    }
}
